//
// Created by syshen on 2021/04/14
//

#ifndef FACE_MNN_BASE_UTIL_H
#define FACE_MNN_BASE_UTIL_H

#include <string>
#include <vector>
#include <jni.h>

#define syshen_min(a,b) ((a)<(b) ? (a) : (b))
#define syshen_max(a,b) ((a)>(b) ? (a) : (b))

typedef struct location {
    float _x;
    float _y;
}location;

typedef struct landmark {
    float x1;
    float y1;
    float x2;
    float y2;
    float s;
    location point[5];
}landmark;

typedef struct FaceInfo {
    float x1;
    float y1;
    float x2;
    float y2;
    float score;
} FaceInfo;

typedef struct rect_box {
    float cx;
    float cy;
    float sx;
    float sy;
}rect_box;

std::string getDirPath(JNIEnv *env, jstring dirPath);

std::string getFilePath(JNIEnv *env, jstring filePath);

jobjectArray native2JavaFacInfo(JNIEnv *env, std::vector<FaceInfo> face_info,
                                jobjectArray faceArgs, int32_t num_face);

jobjectArray native2JavaFacInfo(JNIEnv *env, std::vector<landmark> face_info,
                                jobjectArray faceArgs, int32_t num_face);


std::string jstring2str(JNIEnv* env, jstring jstr);

#endif //FACE_MNN_BASE_UTIL_H
